home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / biz / dopus / HTTPlister.lha / HTTPlisterV1.8.rexx < prev    next >
OS/2 REXX Batch file  |  1999-01-04  |  19KB  |  797 lines

  1. /* $VER:    HTTPlister.rexx 1.8 1998
  2.    Copyright © 1998 Brian Scott
  3.    Email: bscott@odyssey.apana.org.au
  4. */
  5.  
  6. /* *** HTTPResume by Andrija Antonijevics IS REQUIRED. ***
  7.  
  8. This ARexx script reads and lists an aminet listing either the RECENT
  9.    file or another of the same format into a Dopus lister.
  10.  
  11.    You get 3 columns, Name, Comment & Date giving you the instant sorting
  12.    that Dopus provides in any column by selecting either the 'Name',
  13.    'Comment' or 'Date' labels in the lister.
  14.  
  15.    The aminet file's Dir, Size & Desc. go in the 'Comment' column.
  16.  
  17.    Selecting the 'Comment' label in the lister gets all the aminet
  18.    directories sorted into groups.
  19.  
  20.    Selecting the 'Date' label in the lister gets all the lines sorted in
  21.    the same order as they were in the file they came from. (The 'dates'
  22.    are meaningless - generated for sorting purposes only).
  23.  
  24.    It is actually the 'time' part of the date field that gets incremented,
  25.    the dates remain constant.
  26.  
  27.    o The most downloaded files from Aminet during the week have the date
  28.      22-Feb-88.
  29.  
  30.    o The highest rated programs during the week have the date 30-Mar-98.
  31.  
  32.    o The rest have the date 01-Jan-78.
  33.  
  34.    By adding aminet direc/tories to the FilterOut string below,
  35.    you can prevent some from being listed in the lister.
  36.    Check it out as I've left a couple there as examples and you may
  37.    want to list them.
  38.  
  39.    If you run this script from a Dopus menu etc. set the flag
  40.    Run asynchronously.
  41.  
  42.    YOU WILL NEED TO CHANGE THE VALUE OF THESE VARIABLES:
  43.    ----------------------------------------------------
  44.     o HTTPresume (HTTPresume with it's full path)
  45.     o PRXY       (Your proxy:port) /* See the HTTPResume docs on setting PROXY */
  46.     o amiURL      Your aminet URL (Should start with http://)
  47.     o and as mentioned the FilterOut string will need editing.
  48.  
  49.    If you wish to use this without a proxy remove the PRXY variable line and
  50.    make sure that the aminet URL (amiURL variable below) you choose starts
  51.    with 'http://' and not 'ftp://'. (This comes from someone that doesn't
  52.    use a proxy. I use one so I can't test this).
  53.  
  54.    And if you like you can free up the sound system below. For indicating
  55.    when the downloading has finished.
  56.  
  57. Note!
  58.  * This is strictly USE AT YOUR OWN RISK.
  59.  * This has only been tested with Directory Opus 5.661 Magellan and
  60.  * HTTPResume 1.3.
  61.  * The names listed in the lister are only pseudo-files and can't be
  62.  * treated as you would other file names in normal listers. Only apply
  63.  * the actions that I outline and it should all work OK.
  64.  
  65. */
  66.  
  67. /***** Main Variables *********/
  68.  
  69.               /* As many as you like, that you DON'T want in the lister. */
  70. FilterOut   = "comm/ambos comm/bbs comm/cnet"  /* eg. */
  71.  
  72. HTTPresume  = 'DATA:COMM/WEB/HTTPResume/HTTPResume'
  73.  
  74. PRXY        = "HTTP://anonymous:you@whereever.you.are:8080"
  75.  
  76.              /* Suit yourself for your aminet URL */
  77. /* amiURL      = "http://ftp.wustl.edu/pub/aminet/" */
  78. /* amiURL      = "wuarchive.wustl.edu/~aminet/dirs/aminet/" */
  79.  
  80. amiURL      = "http://ftp.livewire.com.au/pub/aminet/"
  81.  
  82. DDir        = "RAM:"  /* Where the downloaded files will end up. */
  83.  
  84. /***** Sound System setup *********/
  85.    /* You'll need to free this up (remove the comment tags)
  86.       and give paths etc. for your player and sound file.
  87.     */
  88.  
  89. /*
  90. soundafter  = 300  /* Only play a sound (to notify finish of downloading)    */
  91.                    /* if it takes longer than this many seconds to download. */
  92.  
  93.   /* Find sound files at http://www.moviesounds.com/ */
  94. fini_sound  = "DATA:COMM/Sound/12-1234.wav"
  95.  
  96. soundplayer = "c:play16"
  97.  
  98.   /* eg. of how it's run.. ADDRESS command soundplayer||" >nil: "||fini_sound */
  99.  
  100. */
  101.  
  102. /***** It's All Action from here on.. (Tamper at your own peril.) *********/
  103. parse arg listingfyl
  104.  
  105. ADDRESS 'DOPUS.1'
  106. OPTIONS RESULTS
  107. signal on syntax
  108. LF = '0a'x
  109.  
  110. dopus version
  111. If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
  112.     dopus request '"This script requires DOpus v5.5 or greater." OK'
  113.     EXIT
  114.     end
  115.  
  116. httpargs = sethttparg(DDir)
  117.  
  118. maxsgsz    = 3000   /* Msg of day size to show in Req. Larger gets Read. */
  119. HTTPlabel  = "HTTPlister"
  120. topdefault = "Aminet listing"
  121. toploading = 'Loading list..'
  122. Amotd      = ""
  123.  
  124. HTTPToolBar = "GETAMINET.BUTTONS"
  125.  
  126. if ~show('L','rexxsupport.library') then
  127.    addlib('rexxsupport.library',0,-30,0)
  128.  
  129. if listingfyl = "" then listingfyl = slcd()
  130.  
  131. if listingfyl = "" then CALL tata('"You need to provide ONE aminet listing file."')
  132.  
  133. listingOK = chkfyl(listingfyl) /* Returns with the listing file still open. */
  134.  
  135. if ~listingOK then do
  136.    CALL close('r')
  137.    CALL tata(listingfyl||LF||'"Doesn''t contain an aminet listing."')
  138.    end
  139.  
  140. ln = chkln  /* The first line that proved to be of aminet format. */
  141.  
  142. running = chkrunning()  /* Check if HTTPlister is already running, if it is */
  143.                         /* use the same lister to view an incoming list.    */
  144. if running > 0 then do
  145.    CALL loadrunning(running)
  146.    if Amotd ~= "" then CALL readAmotd()  /* Message of the day. */
  147.    EXIT
  148.    end
  149.  
  150. lister new "1/11/690/425 "
  151. ALH = result
  152.  
  153. lister set ALH TOOLBAR HTTPToolBar   /* getaminet.buttons */
  154. lister set ALH display name comment date
  155. lister set ALH source
  156. lister set ALH title toploading
  157. lister set ALH label HTTPlabel
  158.  
  159. lister clear ALH
  160. lister refresh ALH full
  161. lister set ALH busy 1
  162.  
  163. CALL loadlist()    /* Listing file gets closed here. */
  164.  
  165. topmsg = gettopmsg(listingfyl)
  166.  
  167. lister set ALH busy 0
  168. lister set ALH title topmsg
  169. lister refresh ALH full
  170.  
  171. handlername = HTTP||ALH
  172.  
  173. dopus addtrap '*' handlername     /* Trap all dopus commands. */
  174.  
  175. dopus remtrap 'none' handlername  /* UnSelect button uses 'none' */
  176.  
  177. if Amotd ~= "" then CALL readAmotd()
  178.  
  179. lister set ALH handler handlername
  180. CALL openport(handlername)
  181.  
  182.  
  183. do until event='inactive'
  184.    if waitpkt(handlername) then do
  185.       packet=getpkt(handlername)
  186.  
  187.       if packet~='00000000'x then do
  188.  
  189.          event=getarg(packet,0)
  190.          desti=getarg(packet,1)
  191.          namestr=getarg(packet,2)
  192.          user=getarg(packet,3)
  193.          pathstr=getarg(packet,4)
  194.          reqreturn=getarg(packet,5)
  195.          qualifier=getarg(packet,6)
  196.  
  197.          CALL delay(10)
  198.  
  199.          select
  200.             when (qualifier='shift') & (event='doubleclick') then
  201.                CALL readOPT()
  202.             when event='Parent' then
  203.                CALL downloadOPT()
  204.             when event='Assign' & (strip(reqreturn,'b') ~= "") then
  205.                DDir = reqreturn
  206.             when event='Root' then do
  207.                lister set ALH source
  208.                lister set ALH busy 1
  209.                CALL findstring()
  210.                lister set ALH busy 0
  211.                end
  212.             when (event='doubleclick') then CALL timedmsg("Shift-Select to read")
  213.             when (event='All') then do
  214.                CALL load()
  215.                if Amotd ~= "" then CALL readAmotd()
  216.                end
  217.             when (event='drop') then do
  218.                if words(namestr) = 1 then do
  219.                   lister query user path
  220.                   reqreturn = result||namestr
  221.                   CALL load()
  222.                   if Amotd ~= "" then CALL readAmotd()
  223.                   end
  224.                else CALL givemsg('"You need to provide ONE aminet listing file."')
  225.                end
  226.             when (qualifier='shift') & (event='dropfrom') then do
  227.                lister query user busy
  228.                if ~result then do
  229.                   if words(namestr) = 1 then do
  230.                      DDir = reqreturn
  231.                      Dhandle = user     /* Adopt lister for downloading */
  232.                      CALL readOPT()
  233.                      end
  234.                   else
  235.                      CALL givemsg('"Sorry only ONE readme at a time."')
  236.                   end
  237.                end
  238.             when (event='dropfrom') then do
  239.                lister query user busy
  240.                if ~result then do
  241.                   DDir = reqreturn
  242.                   Dhandle = user
  243.                   lister set user dest
  244.                   lister refresh user
  245.                   do s = 1 to words(namestr) /* 'dropfrom' de-selected them. */
  246.                      lister select ALH word(namestr,s) on
  247.                      end
  248.                   lister refresh ALH
  249.  
  250.                   CALL downloadOPT()
  251.                   end  
  252.                end
  253.             otherwise NOP
  254.             end
  255.  
  256.          CALL reply(packet,0)
  257.          end
  258.       end
  259.    end
  260.  
  261. CALL closeport(handlername)
  262.  
  263.  
  264. EXIT
  265.  
  266.  
  267. readOPT:
  268. lister set ALH busy 1
  269. httpargs = sethttparg(DDir)
  270. CALL gogetrm(namestr)
  271. lister set ALH busy 0
  272. if exists(DDir||refyl) then do
  273.    dopus read DDir||refyl
  274.    if event='dropfrom' then CALL showdownloads()
  275.    end
  276. else
  277.    CALL givemsg(refyl||'" not downloaded!"')
  278.  
  279. RETURN
  280.  
  281.  
  282. downloadOPT:
  283. lister set ALH source
  284. lister set ALH busy 1
  285. httpargs = sethttparg(DDir)
  286. gotem = gogetem()
  287. lister set ALH busy 0
  288. if gotem then CALL showdownloads()
  289.  
  290. RETURN
  291.  
  292.  
  293. load:
  294. listingOK = chkfyl(reqreturn) /* Returns with file still open. */
  295.  
  296. if ~listingOK then do
  297.    CALL close('r')
  298.    CALL givemsg(reqreturn||LF||'"Doesn''t contain an aminet listing."')
  299.    end
  300. else do
  301.   lister set ALH source
  302.    ln = chkln
  303.    lister set ALH title toploading
  304.    lister refresh ALH full
  305.    lister set ALH busy 1
  306.    lister clear ALH
  307.    CALL loadlist()    /* File gets closed here. */
  308.    topmsg = gettopmsg(reqreturn)
  309.    lister set ALH busy 0
  310.    lister set ALH title topmsg
  311.    lister refresh ALH full
  312.    end
  313.  
  314. RETURN
  315.  
  316.  
  317. chkrunning:
  318. ALH = 0
  319.  
  320. lister query all var handles
  321.  
  322. hcount = words(handles)
  323.  
  324. do h = 1 to hcount
  325.    hndl = word(handles,h)
  326.    lister query hndl toolbar   /* query label doesn't want to work?! */
  327.    TB = upper(result)
  328.    if index(TB,HTTPToolBar) > 0 then ALH = hndl
  329.    end
  330.  
  331. RETURN ALH
  332.  
  333.  
  334. loadrunning:
  335. arg ALH
  336.  
  337.    lister set ALH source
  338.    lister set ALH title toploading
  339.    lister set ALH busy 1
  340.    lister refresh ALH full
  341.    lister clear ALH
  342.    CALL loadlist()    /* File gets closed here. */
  343.    topmsg = gettopmsg(listingfyl)
  344.    
  345.    lister set ALH busy 0
  346.    lister set ALH title topmsg
  347.    lister refresh ALH full
  348.  
  349. RETURN
  350.  
  351.  
  352. loadlist:
  353.  
  354. lynnum = 0
  355. MDF = 0; HRP = 0
  356. Amotd  = ""
  357. LF     = '0a'x
  358.  
  359. do while ~EOF('r')
  360.    if ln ~= "" then do
  361.       if index(ln,"|") = 1 then do
  362.          MDF = 0; HRP = 0
  363.          do while index(ln,"|") = 1 & ~EOF('r')
  364.             select
  365.                when index(ln,"most downloaded files") > 0 then MDF = 1
  366.                when index(ln,"highest rated programs") > 0 then HRP = 1
  367.                otherwise NOP
  368.                end
  369.             ln = readln('r')
  370.             end
  371.          parse var ln +18 t1 +1 ap +10 t2 +1 .
  372.          if ~((t1||t2 == "  ") & (index(ap,"/") >0)) & (MDF | HRP) then do
  373.             MDF = 0; HRP = 0
  374.             end
  375.          end
  376.       if EOF('r') then LEAVE
  377.       parse var ln +18 t1 +1 ap +10 t2 +1 .
  378.       if index(ln,"Message of the day:") > 0 then do
  379.          do while ~EOF('r') & ~((t1||t2 == "  ") & (index(ap,"/") >0))
  380.             Amotd = Amotd||ln||LF
  381.             ln = readln('r')
  382.             parse var ln +18 t1 +1 ap +10 t2 +1 .
  383.             end
  384.          end
  385.       if EOF('r') then LEAVE
  386.       parse var ln aminame amidir amirest
  387.       if (index(FilterOut,amidir) = 0) & (t1||t2 == "  ") & (index(ap,"/") >0) then do
  388.          lynnum = lynnum +1
  389.          select
  390.            when MDF then linedayt = lynnum +320025661
  391.            when HRP then linedayt = lynnum +638755261
  392.            otherwise linedayt = lynnum
  393.            end
  394.          entry.name = aminame
  395.          entry.comment = amidir||amirest
  396.          entry.date = linedayt
  397.          lister addstem ALH entry
  398.          end
  399.       end
  400.  
  401.    ln = readln('r')
  402.  
  403.    end
  404.  
  405. CALL close('r')
  406.  
  407. RETURN
  408.  
  409.  
  410. gogetem:
  411. lister query ALH numselfiles
  412. totsel = result
  413.  
  414. gotsome   = 0
  415. numdwnldd = 0
  416.  
  417. if totsel ~> 0 then RETURN gotsome
  418.  
  419. lister query ALH selfiles stem fyl.
  420.  
  421. loadmsg = loadHTTPresume()
  422.  
  423. if loadmsg = "" then do
  424.    ADDRESS 'DOPUS.1'
  425.    do i = 0 to totsel -1
  426.       lister query ALH entry fyl.i stem fylinfo
  427.  
  428.       parse var fylinfo.comment amipath rest
  429.  
  430.       if totsel > 1 then
  431.          DLfsz.i = getasz(left(amipath||rest,16))
  432.  
  433.       Uset.i = amiURL||amipath||"/"||fyl.i
  434.       end
  435.  
  436.    tmp = time(reset)  /* set elapsed time to 0.00  */
  437.  
  438.    if totsel > 1 then do   /* Bubble smallest to highest */
  439.       do ii=0 to totsel -1
  440.          do j=ii+1 to totsel -1
  441.             if DLfsz.ii > DLfsz.j then parse value Uset.ii Uset.j fyl.ii fyl.j DLfsz.ii DLfsz.j with Uset.j Uset.ii fyl.j fyl.ii DLfsz.j DLfsz.ii .
  442.             end
  443.          end
  444.       end
  445.  
  446.    
  447.    ADDRESS(Port)
  448.    
  449.    do J=0 to totsel-1
  450.       SET OUTFILE DDir||fyl.J
  451.       SET URL Uset.J
  452.       START
  453.       Working=1
  454.   
  455.       do while Working>0
  456.        QUERY FINISHED
  457.        Working=Result
  458.        CALL Delay(150) /* Pause 3 seconds */
  459.        end
  460.   
  461.       if exists(DDir||fyl.J) then do
  462.          numdwnldd = numdwnldd +1
  463.          CALL deselect(fyl.J)
  464.          ADDRESS(Port)
  465.          end
  466.  
  467.       end
  468.    
  469.    QUIT
  470.    
  471.    if (time(elapsed) >soundafter) & exists(soundplayer) & exists(fini_sound) then do
  472.       ADDRESS command soundplayer||" >nil: "||fini_sound
  473.       CALL delay(100)
  474.       end
  475.    else
  476.       CALL delay(150)
  477.  
  478.    ADDRESS 'DOPUS.1'
  479.    
  480.    lister query ALH numselfiles
  481.    numnotfound = result
  482.    
  483.    if numnotfound > 0 then dopus request '"Number of files not found: "'||numnotfound' OK'
  484.    end
  485. else
  486.  if index(loadmsg,"temporary file") = 0 then dopus request 'loadmsg'
  487.  
  488. if numdwnldd > 0 then gotsome = 1
  489.  
  490. RETURN gotsome
  491.  
  492.  
  493. gogetrm:
  494. parse arg rf
  495.  
  496. parse var rf nm "." .
  497.  
  498. refyl = nm||".readme"
  499.  
  500. loadmsg = loadHTTPresume()
  501.  
  502. if loadmsg = "" then do
  503.    lister query ALH entry rf stem fylinfo
  504.    parse var fylinfo.comment amipath .
  505.    Uset  = amiURL||amipath||"/"||refyl
  506.    ADDRESS(Port)
  507.    
  508.    SET OUTFILE DDir||refyl
  509.    SET URL Uset
  510.    START
  511.    Working=1
  512.    do while Working>0
  513.       QUERY FINISHED
  514.       Working=Result
  515.       CALL Delay(150) /* Pause 3 seconds */
  516.       end
  517.  
  518.    QUIT
  519.    end
  520. else
  521.  if index(loadmsg,"temporary file") = 0 then dopus request 'loadmsg'
  522.  
  523. RETURN
  524.  
  525.  
  526. loadHTTPresume:
  527. succ = ""
  528.  
  529. TmpFile='T:HTTPResume.tmp.'||random(,,time('s'))||'.'random(,,)
  530.  
  531. ADDRESS COMMAND 'Run '||HTTPresume||httpargs||TmpFile
  532.  
  533. CALL Delay(150) /* Wait 3 seconds for HTTPResume to start */
  534.  
  535. if ~OPEN(PortFile, TmpFile, 'R') then
  536.    succ = '"Couldn''t open temporary file!"'
  537. else do
  538.    Port=READLN(PortFile)
  539.    CLOSE(PortFile)
  540.    CALL DELETE(TmpFile)
  541.    IF Port='***' then succ = '"HTTPResume couldn''t open its ARexx port!"'
  542.    end
  543.  
  544. RETURN succ
  545.  
  546.  
  547. deselect: procedure expose ALH
  548. parse arg fyl
  549.  
  550. ADDRESS 'DOPUS.1'
  551. lister select ALH fyl off   /* De-select that file. */
  552. lister refresh ALH
  553.  
  554. RETURN
  555.  
  556.  
  557. showdownloads:
  558.  
  559. lister query all
  560. alltrs = result
  561.  
  562. stillopen = index(alltrs,Dhandle)
  563.  
  564. select
  565.   when stillopen > 0 then do
  566.     lister set Dhandle dest
  567.     lister read Dhandle DDir
  568.     end
  569.   when stillopen = 0 then do
  570.     lister new "1/200/350/200 " DDir
  571.     Dhandle = result
  572.     lister wait Dhandle
  573.     lister set Dhandle dest
  574.     end
  575.     otherwise NOP
  576.      end
  577.  
  578. RETURN
  579.  
  580.  
  581. slcd:
  582. rcnt = ""
  583.  
  584. lister query source; if RC > 0 then RETURN rcnt
  585. src = result
  586.  
  587. lister query src numselfiles
  588. totsel = result
  589.  
  590. if (totsel = 0) | (totsel > 1) then RETURN rcnt
  591.  
  592. lister query src path
  593. srcpth = result
  594.  
  595. lister query src selfiles stem fyl.
  596. amilist = fyl.0
  597.  
  598. rcnt = srcpth||amilist
  599.  
  600. lister select src amilist off   /* De-select that file. */
  601. lister refresh src
  602.  
  603. RETURN rcnt
  604.  
  605.  
  606. chkfyl: procedure expose chkln recdayt
  607. parse arg amilisting
  608.  
  609. rcntOK  = 1
  610. lncntr  = 0
  611. maxcnt  = 100
  612. recdayt = ""
  613.  
  614. if ~open('r',amilisting,'r') then CALL tata('"Can''t open "'||amilisting, 20)
  615.  
  616. chkln = readln('r')
  617.  
  618. parse var chkln +18 t1 +1 ap +10 t2 +1 .
  619.  
  620. do while ~EOF('r') & ~((t1||t2 == "  ") & (index(ap,"/") >0)) & ~(lncntr > maxcnt)
  621.    lncntr = lncntr +1
  622.    chkln = readln('r')
  623.    if index(chkln,"Date:") = 1 then recdayt = getrecdayt(chkln)
  624.    parse var chkln +18 t1 +1 ap +10 t2 +1 .
  625.    end
  626.  
  627. if EOF('r') | (lncntr > maxcnt) then do
  628.    CALL close('r')
  629.    rcntOK = 0
  630.    end
  631.  
  632. RETURN rcntOK
  633.  
  634.  
  635. getrecdayt:
  636. parse arg rdl
  637. rcd = ""
  638.  
  639. parse var rdl "Date:" . ", " dayt +11 rest
  640. if index("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",word(dayt,2)) > 0 then rcd = dayt
  641.  
  642. RETURN rcd
  643.  
  644.  
  645. findstring: procedure expose ALH srchstr
  646.  
  647. oldstr = ""
  648.  
  649. if (srchstr ~= "SRCHSTR") & (srchstr ~= "RESULT") then oldstr = srchstr
  650.  
  651. dopus getstring '"Non-case sensitive search. Don''t use wild cards." "'||oldstr||'" Okay|Cancel'
  652. srchstr = result
  653. butt = DOPUSRC
  654.  
  655. Usrchstr = upper(srchstr)
  656.  
  657. if (srchstr="RESULT" & butt<1) | (butt=1 & srchstr="RESULT" ) then RETURN
  658.  
  659. lister query ALH  files stem filename.
  660.  
  661. lister query ALH  numfiles
  662. filecount = result
  663.  
  664. lister clear ALH  abort
  665. lister set ALH newprogress abort bar name title
  666. lister set ALH newprogress title "Searching both columns for "||srchstr
  667. lister set ALH newprogress bar numsel 0
  668.  
  669. do i = 0 to filecount-1
  670.  
  671.    lister set ALH newprogress name filename.i
  672.    lister set ALH newprogress bar filecount i
  673.  
  674.    lister query ALH entry filename.i stem fileinfo.
  675.    if index(upper(filename.i||fileinfo.comment),Usrchstr) > 0 then lister select ALH  filename.i 1
  676.  
  677.    lister query ALH abort
  678.    if result = 1 then do
  679.       lister set ALH newprogress off
  680.       lister refresh ALH full
  681.       RETURN
  682.       end
  683.  
  684.    end
  685.  
  686. lister set ALH  newprogress off
  687.  
  688. lister refresh ALH  full
  689.  
  690. RETURN
  691.  
  692.  
  693. gettopmsg:
  694. parse arg lstfyl
  695.  
  696.  tfnm = fylname(lstfyl)
  697.  tmsg = tfnm||" "||recdayt
  698.  if datatype(tfnm,'n') then tmsg = topdefault||" "||recdayt
  699.  
  700. RETURN tmsg
  701.  
  702.  
  703. fylname:
  704. parse arg fdir
  705. slpos = lastpos('/',fdir)
  706.  
  707. parse var fdir ":"fn
  708. if slpos > 0 then fn = substr(fdir,slpos+1)
  709.  
  710. RETURN fn
  711.  
  712.  
  713. getasz: procedure
  714. arg afsz
  715.  
  716. fsz = 0
  717. parse var afsz nm sz .
  718. kpos = index(sz,'K')
  719. mpos = index(sz,'M')
  720. select
  721.    when kpos > 0 then fsz=left(sz,kpos-1)
  722.    when mpos > 0 then fsz=left(sz,mpos-1)*1000
  723.    otherwise NOP
  724.    end
  725.  
  726. RETURN fsz
  727.  
  728.  
  729. readAmotd:
  730. if length(Amotd) < maxsgsz then
  731.    CALL givemsg('"'||Amotd||'"')
  732. else
  733.    CALL readmsg(Amotd)
  734.  
  735. RETURN
  736.  
  737.  
  738. sethttparg:
  739. parse arg dwldir
  740. if PRXY = "PRXY" | PRXY = "" then
  741.    hargs = ' OVERWRITE SD='||dwldir||' DEBUG='||dwldir||'HTTPdebug.log WINWIDTH=450 GUI NOERRREQ RXPORTFILE='
  742. else
  743.    hargs = ' OVERWRITE PROXY='||PRXY||' SD='||dwldir||' DEBUG='||dwldir||'HTTPdebug.log WINWIDTH=450 GUI NOERRREQ RXPORTFILE='
  744.  
  745. RETURN hargs
  746.  
  747.  
  748. readmsg: procedure
  749. parse arg msg
  750.  
  751. CALL open('w',"T:temp_msg",'w')
  752. CALL writeln('w',msg)
  753. CALL close('w')
  754. dopus read "T:temp_msg"
  755.  
  756. RETURN
  757.  
  758.  
  759. timedmsg:
  760. ADDRESS 'DOPUS.1'
  761. parse arg msg
  762. lister set ALH title msg
  763. lister refresh ALH full
  764. CALL delay(250)
  765. lister set ALH title topdefault
  766. lister refresh ALH full
  767.  
  768. RETURN
  769.  
  770.  
  771. givemsg:
  772. ADDRESS 'DOPUS.1'
  773. parse arg msg
  774. dopus request ''msg' OK'
  775.  
  776. RETURN
  777.  
  778.  
  779. tata:
  780. ADDRESS 'DOPUS.1'
  781. parse arg msg
  782. dopus request ''msg' OK'
  783. EXIT
  784.  
  785.  
  786. syntax:
  787. LF = '0a'x
  788. ADDRESS 'DOPUS.1'
  789. errmsg = '"ABORTING!"'||LF||'"Please report this error:"'||LF||'"Syntax Error "'||rc||'" , "'||"'"||errortext(rc)||"'"||'" in line "'||sigl||'"."'
  790. lister set ALH busy 0
  791. dopus request ''errmsg' OK'
  792. lister query ALH handler
  793. if result = handlername then CALL closeport(handlername)
  794. lister close ALH
  795. EXIT
  796.  
  797.